package shayu.order.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;


@Data
@Component
@ConfigurationProperties(prefix = "alipay")
public class AlipayTemplate {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000122692196";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCUNUunwbVITCmMqkysgBC8fHv42Jgv00oHTVZuSSWHWC/cyCF3gZ3bX3ksg+rdzf5DcQn0cNJA1s+g3VQHwMMt3+c72cmXLyVKzBJUSiVvcS9699a4mT0XRzc3QfCgv9ZqPrRq4wdExdP5LHyD+84HeFVOKPmIsWOnwiHknBZSo/Th6qszumzF3A2l1iZ2IXwcvNLd+b9jneVIqnNODW4CcdTCiIvF2hQAsQw4rbV124+f7zbkNapNDEyY0/hLnfcCpqIqElp5DUuKDWe6E+CKindKG2hmifjZTp1Ra9khj/6m32P7pZaOyEAm2lBCjfuERP0VVKblmjfv6iY+h79TAgMBAAECggEAWuDbRUCYYn6hM6nxXg0hNhK3Cf32Q80xpYycpP+hTX6byqvFKbyHCU9fxBYX3G5FrSERU5wisLOHmUJeFmryw5x58881t8im+1hrHNhiYBVtYd+7AHKmbTGz/+QlIsy/M2LDyo7vlBIiSrYmm9+5lAcLd+PULydmziVSFxZG8eC8N25Fi5dBmyq3Zg46XsRtB4tLihvMntmemCYKdy8yFxSRWZrmRjqrocgs2H25EfqKEeAoTqV1CJfPj8zFd+i302AjrJFd/mTR3sK1SOCpHSbQeLy/Qp7PMCZ/SQ1DKRzikm6MnncTTZJijqx7O5use9K1oPEKgnXDOuJD3mlp0QKBgQDN1ywAmZIrTRgPG40qEz8zwoZQe0nWRF9Exz/S0zL6o89nuH0IBFgiOPZ8wCh759+KZD+uH2o5V27Z9PD688ZoTFB1TDGS7BNN16Cj8BJNqtcn1EbzE7VxbV/jdlvTn0RUm3GI9O5UNoDOxq3FveMT6w1vmA/wBmRjoTRysQYOLwKBgQC4UuE9FWF3g+yowHLMX20U6ww6hMketJ2gJngNPWtoJ/JsIi/nLXQ5OjssovGJamOnR7loPIin/8odrLA8MF62jU/F0KI+icK7j/hdbrgPQ1VmkyoDMiZTa6Q4vme2/Dyu4LPFKBk8rw7v0iiuZUgF6Xaiuvr5bsv+bJ2UDaUcHQKBgQCnkcuYkWyVI6W6Zst8vT5ufKWrTzLE49RKwYoLrzOJJ2HpJh9jL2YwNf8zf5t1g0ZP+1x7+8cV9z+e3/Bt25Zhwf6d/vE8kkME081KqF2+LJ4LJpy7tge31zqAihInLTkLR6AdxodetyAVNVix6eu6g1fkyP3wgMOo98sis0oisQKBgCjh+SNbQqsHj84+IThDUiZ5m9S+7vzogq2q2qXVIaWQdqyVSJq18jlfORDFc11PQ5suxWjhRE4+5c1/J/exotBKt47gn5vPYmnHnQbcL+bywFZn/cGHtgh6r4oGcWqct7jyDe2E31QeX+nBa1SDEl59Udr2LgR1FrnvzWOxQxXhAoGAflahpjjVYZIkgpSc1E+Bk6Zmj/Nw+yxlIndYyAHb7yWiL5tvUxGAiDCgiLKZZGGWnjoC3wMp41WlwofiAnZy5rGt25SxrM4GzQwKpT3ldwu/zdlgFZ1YfUUlkmvVnndULB4IsaIsjyTomWWpU4PkHE61RiogHn/0kw0NFVffZQE=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAle4Exr89Vf9zqQ0QS5uPnsIzFdtz//C57KoWayh+Mx9GH0yfI/785KYMwTgydIt2ppTOV4jSnCFGvijbZKCQQVysaxa5oiI09YdnGB1j+Lp3yFuS+UJ5Ld0m644z+MD2kQ1MOIuaVstke5T44x+yGTMqZgHJd4fTarMXsP3wIPR7Bc3iejSjU8gxAM2pvSqGB6OrVgY2uooa9xnuE2U/nMYt0iz4EB2ickerDAXC51eegRa66DJK1kmgiNBLy4pBimuzFiiZRQP223Hr/amyNL9rj4YtNcbg6n76HiajFYQixguqQ20mHsU/dE3ClU8PuyJZcS5WKuBh2N9u25HqjQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

